﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WiiPay : PayBase
{

	public override void Init (params string[] key)
	{
		jo = new AndroidJavaObject ("com.pepper.bfyfj.payment.ToamtoPay");
//		jo = new AndroidJavaObject ("com.wiipay.Main");
//		jo.Call ("init");
//		jo.Call ("setCallBack", "TJSDK", "OnPayResult");
	}

	public override void Pay (string moneyAmount, string productName, string produceDesc, System.Action<bool> payCallBack)
	{
		jo.Call ("pay", moneyAmount, productName, produceDesc);
		this.payCallBack = payCallBack;
	}

	public override void OnPayResult (string result)
	{
		if ("0" == result) {
			TJLog ("TJSDK---支付成功");
			if (payCallBack != null) {
				payCallBack (true);
			}
		} else if ("1" == result) {
			TJLog ("TJSDK---支付失败");
			if (payCallBack != null) {
				payCallBack (false);
			}
		} else if ("-1" == result) {
			TJLog ("TJSDK---支付取消");
			if (payCallBack != null) {
				payCallBack (false);
			}
		}
	}
}
